package com.spring.activity;

import android.app.Activity;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.TextView;
import android.widget.Toast;

import com.spring.gowhere.R;
import com.spring.httputils.RestClient;
import com.spring.model.ReturnKQResult;

public class KQInfoActivity extends BaseActivity {
	RestClient restClient = null;
	private String username, logintype;
	private TextView YearMonth, NeedWorkDays, WorkDays, AbsentDays, LateCount,
			LateMins, EarlyCount, EarlyMins, LeaveDays, OtherAbsentDays;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.kqinfo);
		Intent intent = getIntent();

		// 获取该Intent所携带的数据

		Bundle bundle = intent.getExtras();

		// 从bundle数据包中取出数据

		ReturnKQResult kqresul = (ReturnKQResult) bundle
				.getSerializable("kqinfo");
		SharedPreferences userInfo = getSharedPreferences("user_info", 0);
		username = userInfo.getString("username", "");
		logintype = userInfo.getString("logintype", "");
		ImageButton imageButton = (ImageButton) findViewById(R.id.title_left_ib);
		imageButton.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				finish();
			}
		});
		TextView textView = (TextView) findViewById(R.id.title_tv);
		textView.setText("考勤情况");
		YearMonth = (TextView) findViewById(R.id.YearMonth);
		NeedWorkDays = (TextView) findViewById(R.id.NeedWorkDays);
		WorkDays = (TextView) findViewById(R.id.WorkDays);
		AbsentDays = (TextView) findViewById(R.id.AbsentDays);
		LateCount = (TextView) findViewById(R.id.LateCount);
		LateMins = (TextView) findViewById(R.id.LateMins);
		EarlyCount = (TextView) findViewById(R.id.EarlyCount);
		EarlyMins = (TextView) findViewById(R.id.EarlyMins);
		LeaveDays = (TextView) findViewById(R.id.LeaveDays);
		OtherAbsentDays = (TextView) findViewById(R.id.OtherAbsentDays);

		if(kqresul!=null){
			YearMonth.setText(""+kqresul.getYearMonth());
			NeedWorkDays.setText("" + kqresul.getNeedWorkDays());
			WorkDays.setText("" + kqresul.getWorkDays());
			AbsentDays.setText("" + kqresul.getAbsentDays());
			LateCount.setText(""+kqresul.getLateCount());
			LateMins.setText(""+kqresul.getLateMins());
			EarlyCount.setText(""+kqresul.getEarlyCount());
			EarlyMins.setText(""+kqresul.getEarlyMins());
			LeaveDays.setText("" + kqresul.getLeaveDays());
			OtherAbsentDays.setText("" + kqresul.getOtherAbsentDays());
		}else{
			Toast.makeText(KQInfoActivity.this, "没有查询到相关数据", 2).show();
		}

	}
}
